﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Media;

namespace Windows8Accelerator.Core.Xaml.Helpers
{
    public static class ControlHelper
    {
        public static T GetParentOf<T>(this DependencyObject dependencyObject)
        {
            var parent = VisualTreeHelper.GetParent(dependencyObject);
            while (parent != null && !(parent is T))
                parent = VisualTreeHelper.GetParent(parent);
            return (T)(object)parent;
        }
    }
}
